package org.wattdepot.cli.commands;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;

/**
 * Tests the CarbonContent class.
 * 
 * @author Jarret Mizo, Shaun Ramento
 * 
 */
public class TestCarbonContent {
  /**
   * Tests the getCarbonContent method.
   * 
   * @throws Exception if there is an error.
   */
  @Test
  public void testCarbonContent() throws Exception {
    CarbonContent carbonClass = new CarbonContent();
    String source = "SIM_IPP";
    String time = "2009-11-15T12:00:00.000-10:00";
    String samplingInterval = "10";
    String validOutput = "lbs CO2/MWh";
    boolean check;
    check = carbonClass.getCarbonContent(source, time, samplingInterval).contains(validOutput);
    assertTrue("Checking good input", check);
    check =
        carbonClass.getCarbonContent("SomeRandomSource", time, samplingInterval).contains(
            "lbs CO2/MWh");
    assertFalse("Checking bad source name", check);
    check = carbonClass.getCarbonContent(source, "BadTime", samplingInterval).contains(validOutput);
    assertFalse("Checking bad timestamp", check);
    check = carbonClass.getCarbonContent(source, time, "something").contains(validOutput);
    assertFalse("Checking bad sampling interval", check);
    check = carbonClass.getCarbonContent(source, time, "-5").contains(validOutput);
    assertFalse("Checking negative sampling interval", check);
  }

}
